package com.googlecode.imanager.client.event;

import com.googlecode.imanager.client.Control;

/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public class KeyEvent extends InputEvent {

    private int keyCode;
    private char keyChar;
    private KeyEventType eventType;
    
    public KeyEvent(Control target, int keyCode, char keyChar, KeyEventType eventType) {
        super(target);
        setKeyCode(keyCode);
        setKeyChar(keyChar);
        setEventType(eventType);
    }

    public int getKeyCode() {
        return keyCode;
    }

    public void setKeyCode(int keyCode) {
        this.keyCode = keyCode;
    }

    public char getKeyChar() {
        return keyChar;
    }

    public void setKeyChar(char keyChar) {
        this.keyChar = keyChar;
    }

    @Override
    public KeyEventType getEventType() {
        return eventType;
    }

    protected void setEventType(KeyEventType eventType) {
        if (eventType == null){
            throw new IllegalArgumentException("eventType");
        }
        this.eventType = eventType;
    }

}
